﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Logger
{
    public enum LogStyle
    {
        None = 0,
        Console = 0x01,
        File = 0x02,
        MailForServer = 0x04,
        MailForClient = 0x08,
        Xml = 0x16,
        Composite = 0x32,
    };


    public class LoggerFacade
    {
        private ILogger _logger;

        public LoggerFacade()
        {
            make(LogStyle.Console);
        }

        public LoggerFacade(LogStyle type)
        {
            make(type);
        }

        public LoggerFacade(LogStyle type, string path)
        {
            make(type, path);
        }

        /// <summary>
        /// Create a Logger with the input log style
        /// </summary>
        /// <param name="type">Style of log, use LogStyle enum.</param>
        private void make(LogStyle type)
        {
            ILoggerFactory loggerfactory = new LoggerFactoryImplementation();
            _logger = loggerfactory.Make(type);

        }

        /// <summary>
        /// Create a logger with the input file path and log style, currently only supports file loggers
        /// </summary>
        /// <param name="type">Style of log, use LogStyle enum.</param>
        /// <param name="path">A string file path to the directory for the log</param>
        private void make(LogStyle type, string path)
        {
            ILoggerFactory loggerfactory = new LoggerFactoryImplementation();
            _logger = loggerfactory.Make(type, path);
        }


        public string Write(string message)
        {
            return _logger.Write(message);

        }

    }
}
